function addRooms(obj) {
	var baseHtml = _tpl.room;
	var baseDiv = $(obj).parents('div[class="p_rooms"]');
	$(baseDiv).append(baseHtml);
}
function delRooms(obj) {
	var p = $(obj).parent().parent();
	var idx = p.attr('data-id');
	if(idx == undefined || idx == '') {
		p.remove();
	}
}
function addMeals() {
	$('#meals').append(_tpl.meal);
}
function delMeals(obj) {
	var p = $(obj).parent().parent();
	var idx = p.attr('data-id');
	if(idx == undefined || idx == '') {
		p.remove();
	}
}
function addPrices() {
	$('.b_prices').append(_tpl.bprice);
}
function delPrices(obj) {
	var p = $(obj).parent().parent();
	var idx = p.attr('data-id');
	if(idx == undefined || idx == '') {
		p.remove();
	}
}
function eAddPrices() {
	$('.e_prices').append(_tpl.eprice);
}
function delEPrices(obj) {
	var p = $(obj).parent().parent();
	var idx = p.attr('data-id');
	if(idx == undefined || idx == '') {
		p.remove();
	}
}
//tpl

var _tpl = {
	room:'<div style="margin-top:10px;" class="p_room" id="base_room"><div class="col-sm-3"><input style="margin-left:-15px;" type="text" class="form-control col-sm-2" placeholder="请填写房间类型" required/></div><div class="col-sm-3"><input style="margin-left:-15px;" type="text" class="form-control col-sm-2" placeholder="请填写套餐价格" required/></div><div class="col-sm-3"><input style="margin-left:-15px;" type="text" class="form-control col-sm-2" placeholder="单房补差（¥：元）" required/></div><div class="col-sm-3"><button type="button" class="btn btn-w-m btn-success col-sm-2" onclick="delRooms(this)">删除房间</button></div></div>',
	meal:'<div class="col-sm-12"><div><input type="text" class="form-control" placeholder="总天数/住宿天数/潜水次数" required/></div><div id="p_rooms"><div style="margin-top:10px;" class="p_room"><div class="col-sm-3"><input style="margin-left:-15px;" type="text" class="form-control col-sm-2" placeholder="请填写房间类型" required/></div><div class="col-sm-3"><input style="margin-left:-15px;" type="text" class="form-control col-sm-2" placeholder="请填写套餐价格" required/></div><div class="col-sm-3"><input style="margin-left:-15px;" type="text" class="form-control col-sm-2" placeholder="单房补差（¥：元）" required/></div><div class="col-sm-3"><button type="button" class="btn btn-w-m btn-success col-sm-2" onclick="addRooms(this)">添加房间</button></div></div></div><div><button type="button" class="btn btn-w-m btn-success col-sm-2" onclick="delMeals(this)">删除套餐</button></div></div>',
	bprice:'<div class="col-sm-8 b_price" style="margin-top:10px;"><div class="col-sm-10"><input type="text" class="form-control" placeholder="包含费用:请描述该费用项目" required/></div><div class="col-sm-2"><button type="button" class="btn btn-w-m btn-success col-sm-2" onclick="delPrices(this)">删除</button></div></div>',
	eprice:'<div class="col-sm-8 e_price" style="margin-top:10px;"><div class="col-sm-10"><input type="text" class="form-control" placeholder="额外费用:请描述该费用项目" required/></div><div class="col-sm-2"><button type="button" class="btn btn-w-m btn-success col-sm-2" onclick="delEPrices(this)">删除</button></div></div>'
}